﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;
using DevComponents.DotNetBar.Controls;
using RM2012Server.Model;

namespace RM2012Server.View
{
    public partial class frmTesting2 : Form
    {
        delegate void SetTextCallback(string text);

        public frmTesting2()
        {
            InitializeComponent();
        }


        private void buttonItem1_Click(object sender, EventArgs e)
        {

        }

        private void buttonX1_Click(object sender, EventArgs e)
        {
            Thread t = new Thread(new ThreadStart(ClientSend));
            t.Start();
        }

        public void ClientSend()
        {
            MyUDPClient client = new MyUDPClient();
            client.OnConnect();
        }
    }

    class AutoWorking
    {
        private int sleepTime;
        private string strContent;
        private TextBoxX controlX;

        public AutoWorking(int sleepTime, string strContent, TextBoxX controlX)
        {
            this.sleepTime = sleepTime;
            this.strContent = strContent;
            this.controlX = controlX;
        }

        public void DoWork()
        {
            Thread current = Thread.CurrentThread;
            Thread.Sleep(sleepTime);
            ContentText(strContent, controlX);
        }

        public void ContentText(string str, TextBoxX c)
        {
            c.Text = str;
        }
    }
}
